1. Field of the Invention
The present invention generally relates to a method and apparatus for entropy-coding/entropy-decoding video data, and more particularly, to a method and apparatus for entropy-coding/entropy-decoding video data by efficiently binarizing discrete cosine transform (DCT) coefficients of a residual block of a current block.
2. Description of the Related Art
In video compression standards, such as moving picture expert group (MPEG)-1, MPEG-2, and H.264/MPEG-4 advanced video coding (AVC), a picture is divided into predetermined units of video processing, e.g., macroblocks, for video encoding. Each of the macroblocks is then encoded using interprediction or intraprediction. Next, an optimal encoding mode is selected based on the size of data of the encoded macroblock and the degree of distortion between the encoded macroblock and the original macroblock and the macroblock is encoded in the selected encoding mode, as will now be described in detail with reference to FIG. 1.
FIG. 1 is a block diagram of a video encoder 100 according to the related art.
Referring to FIG. 1, a motion compensation unit 104 or an intraprediction unit 106 performs interprediction or intraprediction in block units. The motion compensation unit 104 performs interprediction on the current block based on a motion vector of the current block that is estimated by a motion estimation unit 102, by searching for a reference picture stored in a frame memory 120. The intraprediction unit 106 performs intraprediction on the current block using pixels included in a previously encoded region of the current picture.
A prediction block that is a prediction value for the current block generated as a prediction result is subtracted from the original block, thereby generating a residual block. The generated residual block is transformed into the frequency domain by a transformation unit 108. The transformation unit 108 also performs discrete cosine transformation (DCT), thereby generating coefficients in the frequency domain for the residual block, i.e., DCT coefficients. A quantization unit 110 quantizes the DCT coefficients. The quantized coefficients are entropy-coded by an entropy-coding unit 112 and then inserted into a bitstream.
The coefficients quantized by the quantization unit 110 are inversely quantized by an inverse quantization unit 114 and an inverse transformation unit 116 performs inverse discrete cosine transformation (IDCT) on the inversely quantized coefficients. The residual block reconstructed by the IDCT is added to the prediction block, thereby reconstructing the original block.
The reconstructed original block is deblocking-filtered by a filtering unit 118 and then stored in the frame memory 120 in order to be used for interprediction or intraprediction of another block.
In H.264/AVC coding, entropy-coding is performed by using context-adaptive variable length coding (CAVLC) or context-adaptive binary arithmetic coding (CABAC). Entropy-coding is performed by applying different entropy-coding methods to different syntax elements.
Among a variety of syntax elements, DCT coefficients are CAVLC-coded by run-level coding. A DCT coefficient having a value of ‘0’ is called a ‘run’ and DCT coefficients having values other than ‘0’ are called a ‘level’. The DCT coefficients are binarized separately for ‘runs’ and ‘levels’ and bin strings generated by the binarization are arithmetically coded using a context model.
The DCT coefficients having values other than ‘0’, i.e., the levels, are binarized into variable-length codes using concatenated unary/kth order exponential Golomb binarization and then bin strings generated by the binarization are arithmetically coded, as will now be described in detail with reference to FIG. 2.
Referring to FIG. 2, levels are binarized using a binarization method that is a combination of truncated unary binarization having a maximum code value (cMax) of ‘14’ and 0th order exponential Golomb binarization.
A level having a value (abs_level)<=14 is binarized using only truncated unary binarization and a level having a value >14 is binarized using a combination of truncated unary binarization and exponential Golomb binarization.
However, in the probability distribution of DCT coefficients, levels are concentrated in coefficients of a low-frequency component and runs are concentrated in coefficients of a high-frequency component. In other words, levels are concentrated in an upper left portion of a DCT coefficient block generated by performing DCT on a residual block and runs are concentrated in a lower right portion of the DCT coefficient block. Therefore, it is inefficient to apply the same binarization method as illustrated in FIG. 2 to DCT coefficients because the DCT coefficients are binarized without consideration of the probability distribution of runs and levels.